function! api#wiki#init() abort
    if !exists("g:loaded_vimwiki")
        try
            let g:vimwiki_global_ext = 0
            let g:vimwiki_ext2syntax = {}
            packadd vimwiki
        catch /.*/
            echoerr v:exception
        endtry
    endif
    if exists("g:loaded_vimwiki") && g:loaded_vimwiki
        let g:wiki_map = get(g:, "wki_map", { "name": "+wiki" })
        let g:wiki_map.b = [ "<Plug>Vimwiki2HTMLBrowse", "browse" ]
        let g:wiki_map.c = [ "<Plug>VimwikiTOC", "toc" ]
        let g:wiki_map.C = ["<Plug>VimwikiColorize", "colorize" ]
        let g:wiki_map.d = [ "<Plug>VimwikiDiaryIndex", "diary" ]
        let g:wiki_map.h = [ "<Plug>Vimwiki2HTML", "html" ]
        let g:wiki_map.i = [ "<Plug>VimwikiToggleListItem", "item" ]
        let g:wiki_map.m = [ "<Plug>VimwikiMakeDiaryNote", "tody" ]
        let g:wiki_map.n = [ "<Plug>VimwikiTabMakeDiaryNote", "tab-make-diary-note" ]
        let g:wiki_map.s = [ "<Plug>VimwikiUISelect", "uiselect" ]
        let g:wiki_map.t = [ "<Plug>VimwikiTabIndex", "tab-index" ]
        let g:wiki_map.x = [ "<Plug>VimwikiIndex", "index" ]
        let g:wiki_map.y = [ "<Plug>VimwikiMakeYesterdayDiaryNote", "yesterday" ]
        let g:wiki_link_map = get(g:, "wiki_link_map", { "name": "+link"})
        let g:wiki_link_map.c = ["<Plug>VimwikiDiaryGenerateLinks", "generate" ]
        let g:wiki_link_map.f = ["<Plug>VimwikiFollowLink", "follow" ]
        let g:wiki_link_map.s = ["<Plug>VimwikiSplitLink", "split" ]
        let g:wiki_link_map.v = ["<Plug>VimwikiVSplitLink", "vsplit" ]
        let g:wiki_link_map.b = ["<Plug>VimwikiBaddLink", "badd" ]
        let g:wiki_link_map.d = ["<Plug>VimwikiTabDropLink", "drop" ]
        let g:wiki_link_map.g = ["<Plug>VimwikiGoBackLink", "go-back" ]
        let g:wiki_link_map.n = ["<Plug>VimwikiNextLink", "next" ]
        let g:wiki_link_map.p = ["<Plug>VimwikiPrevLink", "prev" ]
        let g:wiki_link_map.N = ["<Plug>VimwikiNormalizeLink", "normalize" ]
        " `<Plug>VimwikiNormalizeLinkVisual` (visual mode)
        let g:wiki_map.l = g:wiki_link_map
        let g:wiki_goto_map = get(g:, "wiki_goto_map", { "name": "+goto"})
        let g:wiki_goto_map.g = ["<Plug>VimwikiGoto", "goto" ]
        let g:wiki_goto_map.H = ["<Plug>VimwikiGoToPrevHeader", "prev-header" ]
        let g:wiki_goto_map.h = ["<Plug>VimwikiGoToNextHeader", "next-header" ]
        let g:wiki_goto_map.S = ["<Plug>VimwikiGoToPrevSiblingHeader", "prev-sibling" ]
        let g:wiki_goto_map.s = ["<Plug>VimwikiGoToNextSiblingHeader", "next-sibling" ]
        let g:wiki_goto_map.p = ["<Plug>VimwikiGoToParentHeader", "parent" ]
        let g:wiki_map.g = g:wiki_goto_map
        let g:wiki_edit_map = get(g:, "wiki_edit_map", { "name": "+edit"})
        let g:wiki_edit_map.d = ["<Plug>VimwikiDeleteFile", "delete-file" ]
        let g:wiki_edit_map.r = ["<Plug>VimwikiRenameFile", "rename-file" ]
        let g:wiki_edit_map.h = ["<Plug>VimwikiAddHeaderLevel", "add-header" ]
        let g:wiki_edit_map.H = ["<Plug>VimwikiRemoveHeaderLevel", "remove-header" ]
        let g:wiki_edit_map.n = ["<Plug>VimwikiNextTask", "next-task" ]
        let g:wiki_edit_map.n = ["<Plug>VimwikiRemoveCBInList", "VimwikiRemoveCBInList" ]
        let g:wiki_edit_map.n = ["<Plug>VimwikiIncrementListItem", "increment-list-item" ]
        let g:wiki_map.e = g:wiki_edit_map
        let g:space_keymap = get(g:, "space_keymap", { "name": "+space"})
        let g:space_keymap.w = g:wiki_map
    endif
endfunction
